use lazyregexp to compile regexes on first use#5998
Merged
thaJeztah merged 12 commits intodocker:masterfrom Apr 11, 2025
Merged
use lazyregexp to compile regexes on first use#5998thaJeztah merged 12 commits intodocker:masterfrom
thaJeztah merged 12 commits intodocker:masterfrom
Conversation
Based on the "lazyregexp" package in golang.org/x/mod; https://cs.opensource.google/go/x/mod/+/refs/tags/v0.19.0:internal/lazyregexp/lazyre.go;l=66-78 This package allows defining regular expressions that should not be compiled until used, but still providing validation to prevent invalid regular expressions from producing a panic at runtime. This is largely a copy of the package from golang.org/x/mod, with FindAllStringSubmatch and ReplaceAllStringFunc added Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This package needed an (internal) interface to abstract the lazy-regexp. For this, I split the implementation from the exported implementation; this also revealed that some functions are not used (at least not in our code base), and we could consider deprecating these. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5998 +/- ##
==========================================
- Coverage 59.09% 59.06% -0.04%
==========================================
Files 355 356 +1
Lines 29751 29792 +41
==========================================
+ Hits 17582 17597 +15
- Misses 11193 11219 +26
Partials 976 976 🚀 New features to boost your workflow:
|
Benehiko
approved these changes
Apr 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
implement lazyregexp package based on the "lazyregexp" package in golang.org/x/mod;
https://cs.opensource.google/go/x/mod/+/refs/tags/v0.19.0:internal/lazyregexp/lazyre.go;l=66-78
This package allows defining regular expressions that should not be
compiled until used, but still providing validation to prevent
invalid regular expressions from producing a panic at runtime.
This is largely a copy of the package from golang.org/x/mod,
with FindAllStringSubmatch and ReplaceAllLiteralString,
and ReplaceAllStringFunc added
- What I did
- How I did it
- How to verify it
differences;
Before:
After:
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)